const Server = require("./../models/serverModel");
const catchAsync = require("./../utils/catchAsync");

exports.createServer = catchAsync(async (req, res, next) => {
    console.log(req.body);
    await Server.create(req.body);
    res.status(201).json({
        status: "success",
    });
});

exports.getServerFromOrgName = catchAsync(async (req, res, next) => {
    let server = await Server.findOne({ org_name: req.params.orgId })
    if(!server){
        res.json({
            status:"fail",
            message:"学校还没有配备服务设备哦"
        })
        return;
    }
    res.json({
        status:"success",
        server
    })
})
